The present invention relates to data storage devices, and more particularly to execution order control for re-allocation processing of replacing a plurality of defective sectors in the data storage devices.
Devices using various types of media, such as optical disks, magnetic tapes, and semiconductor memories, are known as data storage devices. Among them, hard disk drives (hereinafter referred to as “HDDs”) have become popular as storage devices for computers to such an extent that they are one type of the storage devices indispensable for today's computer systems. Further, not limited to computers, their application is widening more and more due to the superior characteristics with the advent of moving picture recording/reproducing devices, car navigation systems, removable memories for digital cameras and so on.
A magnetic disk used in an HDD has a plurality of tracks that are concentrically formed. Each track is partitioned into a plurality of sectors (servo sectors). Servo data and user data are written to each servo sector. Here, the user data written to each servo sector ranges over a plurality of sectors (data sectors). A head element moves according to servo data. As a result, data can be written or read at a desired address. A signal read out from a magnetic disk by the head element through data read processing is subjected to waveform shaping, decoding processing and other prescribed signal processing by a signal processing circuit before the signal is transmitted to a host. Data transmitted from the host is also subjected to prescribed processing by the signal processing circuit in like manner before the data is written to the magnetic disk by the head element.
If a data sector includes a defect, there is a possibility that user data written to the data sector will be lost. Therefore, the defective sector is replaced with another sector. To be more specific, if a specific data sector is judged to be a defective sector, data of the sector in question is rewritten to an alternate area on a magnetic disk. The alternate area includes a plurality of reserved sectors, each of which stores user data in place of a user sector having a defect. Here, one defective sector is reassigned to one reserved sector. See, e.g., patent document 1 (Japanese Patent Laid-open No. 11-185210).
As one method for defective-sector re-allocation processing, automatic re-allocation processing executed in an execution sequence of a read command is known in the art. An HDD receives a read command from a host, and then reads out data from data sectors within a range specified by the read command. At this time, if a data sector that has been read out is a defective sector, the HDD executes re-allocation processing on the defective sector.
To be more specific, the HDD acquires from the host a read command whose data range covers a plurality of data sectors. Upon reading out data from the first data sector, the HDD judges whether or not the data sector in question is a defective sector. If it is judged that the data sector in question is not a defective sector, the HDD reads out data from the next data sector. If it is judged that the data sector in question is a defective sector, the HDD executes re-allocation processing of the data sector, and then starts reading of the next data sector. By repeating this processing, reserved sectors are assigned before a specific data sector enters a state in which it is unable to be recovered. This makes it possible to improve the reliability of written data.
However, the HDD needs to complete the read command within a specified period of time (timeout period). If the processing of the read command is not completed before the timeout period elapses, the host disconnects the HDD so as to read data from another HDD. This enables the host to prevent the performance of application transactions from decreasing.
Accordingly, the HDD must complete re-allocation processing of replacing defective sectors within a limited period of time before the timeout period elapses. Here, the re-allocation processing includes: accessing a reserved sector; writing data to the reserved sector; and making a check whether or not the data has been successfully written. Accordingly, a sufficient length of time is required to complete the re-allocation processing. Therefore, it is not always possible to complete the re-allocation processing for all defective sectors before the timeout period elapses.